package a_Exception;

import java.io.FileNotFoundException;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package a_Exception
 * @date 2024/3/31 下午6:32
 */
public class Test01 {
    public static void main(String[] args) throws FileNotFoundException {

        String s = ".txt1";
        add(s);
        delete(s);
        update(s);
        search(s);


    }

    private static void update(String s) {
        System.out.println("update");
    }

    private static void search(String s) {
        System.out.println("search");
    }

    private static void delete(String s) {
        System.out.println("delete");
    }

    private static void add(String s ) throws FileNotFoundException {
      if (!s.endsWith(".txt")){
          throw new FileNotFoundException("文件后缀名不对");
        }
        System.out.println("我出异常了");
    }
}
